﻿const express = require("express");

const app = express();

// token
app.set("secret", "asf54a54sf5as");

app.use(require("cors")());
app.use(express.json());
// 托管静态文件
app.use("/boss", express.static(__dirname + "/boss"));
app.use("/", express.static(__dirname + "/web"));
app.use("/", express.static(__dirname + "/web"));
app.use("/api", express.static(__dirname + "/api"));
app.use("/images", express.static(__dirname + "/images"));
// app.use("/uploads", express.static(__dirname + "/uploads"));
require("./db")(app);
require("./routes")(app);

app.listen(3001, err => {
  if (!err) {
    console.log("服务器启动成功,地址是localhost:3001");
  } else {
    console.log(err);
  }
});
